from flask import Blueprint, render_template, send_from_directory
import os

index = Blueprint('index', __name__, template_folder='templates')


@index.get('/')
def index_template():
    return render_template('index.html')


@index.get('/favicon.ico')
def index_favicon():
    dir_path = os.path.abspath(os.path.join(index.root_path, os.pardir, os.pardir, os.pardir, 'static'))
    return send_from_directory(
        dir_path,
        path='favicon.ico',
        mimetype='image/vnd.microsoft.icon'
    )
